
def check1(array):


    return array[0] + array[3] == 13 \
           and array[1] + array[4] + array[5] == 13 \
           and array[2] + array[6] == 13 \
           and array[3] + array[4] + array[7] == 13 \
           and array[5] + array[6] + array[8] == 13

def check2(array):
    map = {}
    for num in array:

        if len(map) == 0:
            map[num] = 1
        else:
            if num in map:
                return False
            else:
                map[num] = 1

    # print(array)

    return True



def func():
    for a in range(1,10):
        for b in range(1, 10):
            for c in range(1, 10):
                for d in range(1, 10):
                    for e in range(1, 10):
                        for f in range(1, 10):
                            for g in range(1, 10):
                                for h in range(1, 10):
                                    for i in range(1, 10):
                                        array = [a, b,c, d, e, f,g, h, i]

                                        if check2(array) and check1(array):
                                            print(array)








if __name__ == '__main__':
    func()